package com.sctvcloud.linshui.ui.adapter.holder;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.widget.CustomEXImageView;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.ruihang.generalibrary.utils.DateUtils;
import com.sctvcloud.linshui.R;
import com.sctvcloud.linshui.beans.NewsItem;
import com.sctvcloud.linshui.ui.adapter.CommonFrgAdapter;
import com.sctvcloud.linshui.ui.utils.GlideUtil;
import com.sctvcloud.linshui.ui.utils.UIUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.jpush.im.android.api.model.ChatRoomInfo;

public class FindFellVillagersChatRoomHolder extends BaseRecylerHolder<ChatRoomInfo> implements View.OnClickListener {
    @BindView(R.id.chat_room_layout)
    protected LinearLayout chat_room_layout;
    @BindView(R.id.chat_room_name)
    protected CustomFontTextView chat_room_name;
    @BindView(R.id.chat_room_icon)
    protected ImageView chat_room_icon;

    private ChatRoomInfo roomInfo;
    private OnChatRommClickListener listener;

    public FindFellVillagersChatRoomHolder(Context context, View itemView, OnChatRommClickListener listener) {
        super(context, itemView);
        itemView.setOnClickListener(this);
        this.listener = listener;
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(ChatRoomInfo info) {
        roomInfo = info;
        chat_room_name.setText(TextUtils.isEmpty(roomInfo.getName()) ? "" : roomInfo.getName());

    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.chat_room_layout) {
            if (null != listener) {
                listener.OnChatRoomClick(roomInfo);
            }
        }
    }

    public interface OnChatRommClickListener {
        void OnChatRoomClick(ChatRoomInfo roomInfo);
    }
}

